<template>
	<div>
		<center><h1>用户注册</h1></center>
		<a-form-item label="用户名" v-bind="formlayout">	
			<a-input v-model="username" />
		</a-form-item>
        <a-form-item label="密码" v-bind="formlayout">
			<a-input v-model="password" />
		</a-form-item>
        <a-form-item label="手机号" v-bind="formlayout">
			<a-input v-model="mobile" />
		</a-form-item>
        <a-form-item label="邮箱" v-bind="formlayout">
			<a-input v-model="email" />
		</a-form-item>
		<a-form-item v-bind="buttonlayout">
			<a-button type="primary"  @click="submit">注册</a-button>
		</a-form-item>
	</div>
</template>

<script type="text/javascript">
import { user_register } from '../axios_send/api'
	export default{
		data(){
			return{
                username:"",
                password:'',
                mobile:'',
                email:'',
				//表单样式
				formlayout:{
					//标签
					labelCol:{
						xs:{span:24},
						sm:{span:8}
					},
					//文本框
					wrapperCol:{
						xs:{span:12},
						sm:{span:5}
					}
				},
				//按钮样式
				buttonlayout:{
					//按钮
					wrapperCol:{
						xs:{
							span:24,
							offset:0
						},
						sm:{span:16,offset:8}
					}
				}
			}

		},
		//自定义方法
		methods:{
			submit:function(){
                var data = {
                    'username':this.username,
                    'password':this.password,
                    'mobile':this.mobile,
                    'email':this.email
                }
                user_register(data).then(res=>{
                    console.log(res)
                })
			}
		}
	};
</script>

<style type="text/css">
	

</style>